<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-local.php',
    require __DIR__ . '/params.php',
    require __DIR__ . '/params-local.php'
);

return [
    'id' => 'app-recite',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'collecter\controllers',
    'defaultRoute' => 'site',//默认路由xxxx/xxxx
    'components' => [

        'db' => [
            'class' 		=> 'yii\db\Connection',
            'dsn' 			=> 'mysql:host=127.0.0.1;dbname=recite',
            'username' 		=> 'root',
            'password' 		=> '',
            'charset' 		=> 'utf8',
            'tablePrefix'	=> 'recite_'
        ],

        'sqlite' => [
            'class' 		=> 'yii\db\Connection',
            'dsn' 			=> 'sqlite:'.dirname(__DIR__).'/data/data.db',
            'username' 		=> '',
            'password' 		=> '',
            'charset' 		=> 'utf8',
            'tablePrefix'	=> ''
        ],

        'request' => [
            'enableCsrfValidation' => false,
            'csrfParam' => '_csrf-recite',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-recite', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the recite
            'name' => 'advanced-recite',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,//暂时未知,默认FALSE
            'suffix' => '.html',
            'rules' => [
                '' => 'site/index',
                'recite'=>'recite/index',
                '<module:\w+>_<controller:\w+>_<action:\w+>' => '<module>/<controller>/<action>',//注意，自定义模块放前边
                '<controller:\w+>_<action:\w+>' => '<controller>/<action>',
            ],

        ]

    ],
    'params' => $params,
];
